"""
最高字符词频统计
不包括标点符号
"""
fi = open('小女孩.txt','r',encoding='utf-8')
fo = open('PY301-2.txt','w')
d={}
txt = fi.read()
for word in txt:
        d[word]  = d.get(word,0)+1
del d["\n"]
ls = list(d.items())
ls.sort(key=lambda x:x[1],reverse=True)
#输出前十个频次最高的中文字符及
for i in range(10):
    fo.write(ls[i][0])
fi.close()
fo.close()

